<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - code analysis - /usr/include/boost/format/feed_args.hpp</title>
  <link rel="stylesheet" type="text/css" href="../../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../../../index.html">top level</a> - <a href="index.html">usr/include/boost/format</a> - feed_args.hpp<span style="font-size: 80%;"> (source / <a href="feed_args.hpp.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">code analysis</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">75</td>
            <td class="headerCovTableEntryLo">0.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2020-09-11 22:25:26</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">10</td>
            <td class="headerCovTableEntryLo">0.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Legend:</td>
            <td class="headerValueLeg">            Lines:
            <span class="coverLegendCov">hit</span>
            <span class="coverLegendNoCov">not hit</span>
</td>
            <td></td>
          </tr>
          <tr><td><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : // ----------------------------------------------------------------------------</a>
<span class="lineNum">       2 </span>            : //  feed_args.hpp :  functions for processing each argument 
<span class="lineNum">       3 </span>            : //                      (feed, feed_manip, and distribute)
<span class="lineNum">       4 </span>            : // ----------------------------------------------------------------------------
<span class="lineNum">       5 </span>            : 
<span class="lineNum">       6 </span>            : //  Copyright Samuel Krempp 2003. Use, modification, and distribution are
<span class="lineNum">       7 </span>            : //  subject to the Boost Software License, Version 1.0. (See accompanying
<span class="lineNum">       8 </span>            : //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<span class="lineNum">       9 </span>            : 
<span class="lineNum">      10 </span>            : //  See http://www.boost.org/libs/format for library home page
<span class="lineNum">      11 </span>            : 
<span class="lineNum">      12 </span>            : // ----------------------------------------------------------------------------
<span class="lineNum">      13 </span>            : 
<span class="lineNum">      14 </span>            : #ifndef BOOST_FORMAT_FEED_ARGS_HPP
<span class="lineNum">      15 </span>            : #define BOOST_FORMAT_FEED_ARGS_HPP
<span class="lineNum">      16 </span>            : 
<span class="lineNum">      17 </span>            : #include &lt;boost/config.hpp&gt;
<span class="lineNum">      18 </span>            : #include &lt;boost/assert.hpp&gt;
<span class="lineNum">      19 </span>            : #include &lt;boost/throw_exception.hpp&gt;
<span class="lineNum">      20 </span>            : 
<span class="lineNum">      21 </span>            : #include &lt;boost/format/format_class.hpp&gt;
<span class="lineNum">      22 </span>            : #include &lt;boost/format/group.hpp&gt;
<span class="lineNum">      23 </span>            : #include &lt;boost/format/detail/msvc_disambiguater.hpp&gt;
<span class="lineNum">      24 </span>            : 
<span class="lineNum">      25 </span>            : namespace boost {
<span class="lineNum">      26 </span>            : namespace io {
<span class="lineNum">      27 </span>            : namespace detail {
<a name="28"><span class="lineNum">      28 </span>            : </a>
<span class="lineNum">      29 </span>            :     template&lt;class Ch, class Tr, class Alloc&gt;
<span class="lineNum">      30 </span><span class="lineNoCov">          0 :     void mk_str( std::basic_string&lt;Ch,Tr, Alloc&gt; &amp; res, </span>
<span class="lineNum">      31 </span>            :                  const Ch * beg,
<span class="lineNum">      32 </span>            :                  typename std::basic_string&lt;Ch,Tr,Alloc&gt;::size_type size,
<span class="lineNum">      33 </span>            :                  std::streamsize w, 
<span class="lineNum">      34 </span>            :                  const Ch fill_char,
<span class="lineNum">      35 </span>            :                  std::ios_base::fmtflags f, 
<span class="lineNum">      36 </span>            :                  const Ch prefix_space, // 0 if no space-padding
<span class="lineNum">      37 </span>            :                  bool center) 
<span class="lineNum">      38 </span>            :     // applies centered/left/right  padding  to the string  [beg, beg+size[
<span class="lineNum">      39 </span>            :     // Effects : the result is placed in res.
<span class="lineNum">      40 </span>            :     {
<span class="lineNum">      41 </span>            :         typedef typename std::basic_string&lt;Ch,Tr,Alloc&gt;::size_type size_type;
<span class="lineNum">      42 </span>            :         res.resize(0);
<span class="lineNum">      43 </span><span class="lineNoCov">          0 :         if(w&lt;=0 || static_cast&lt;size_type&gt;(w) &lt;=size) {</span>
<span class="lineNum">      44 </span>            :             // no need to pad.
<span class="lineNum">      45 </span><span class="lineNoCov">          0 :             res.reserve(size + !!prefix_space);</span>
<span class="lineNum">      46 </span><span class="lineNoCov">          0 :             if(prefix_space) </span>
<span class="lineNum">      47 </span>            :               res.append(1, prefix_space);
<span class="lineNum">      48 </span><span class="lineNoCov">          0 :             if (size)</span>
<span class="lineNum">      49 </span><span class="lineNoCov">          0 :               res.append(beg, size);</span>
<span class="lineNum">      50 </span>            :         }
<span class="lineNum">      51 </span>            :         else { 
<span class="lineNum">      52 </span><span class="lineNoCov">          0 :             std::streamsize n=static_cast&lt;std::streamsize&gt;(w-size-!!prefix_space);</span>
<span class="lineNum">      53 </span>            :             std::streamsize n_after = 0, n_before = 0; 
<span class="lineNum">      54 </span><span class="lineNoCov">          0 :             res.reserve(static_cast&lt;size_type&gt;(w)); // allocate once for the 2 inserts</span>
<span class="lineNum">      55 </span><span class="lineNoCov">          0 :             if(center) </span>
<span class="lineNum">      56 </span><span class="lineNoCov">          0 :                 n_after = n/2, n_before = n - n_after; </span>
<span class="lineNum">      57 </span>            :             else 
<span class="lineNum">      58 </span><span class="lineNoCov">          0 :                 if(f &amp; std::ios_base::left)</span>
<span class="lineNum">      59 </span>            :                     n_after = n;
<span class="lineNum">      60 </span>            :                 else
<span class="lineNum">      61 </span>            :                     n_before = n;
<span class="lineNum">      62 </span>            :             // now make the res string :
<span class="lineNum">      63 </span><span class="lineNoCov">          0 :             if(n_before) res.append(static_cast&lt;size_type&gt;(n_before), fill_char);</span>
<span class="lineNum">      64 </span><span class="lineNoCov">          0 :             if(prefix_space) </span>
<span class="lineNum">      65 </span>            :               res.append(1, prefix_space);
<span class="lineNum">      66 </span><span class="lineNoCov">          0 :             if (size)  </span>
<span class="lineNum">      67 </span><span class="lineNoCov">          0 :               res.append(beg, size);</span>
<span class="lineNum">      68 </span><span class="lineNoCov">          0 :             if(n_after) res.append(static_cast&lt;size_type&gt;(n_after), fill_char);</span>
<span class="lineNum">      69 </span>            :         }
<span class="lineNum">      70 </span><span class="lineNoCov">          0 :     } // -mk_str(..) </span>
<span class="lineNum">      71 </span>            : 
<span class="lineNum">      72 </span>            : 
<span class="lineNum">      73 </span>            : #if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
<span class="lineNum">      74 </span>            : // __DECCXX needs to be tricked to disambiguate this simple overload..
<span class="lineNum">      75 </span>            : // the trick is in &quot;boost/format/msvc_disambiguater.hpp&quot;
<span class="lineNum">      76 </span>            :   
<span class="lineNum">      77 </span>            :     template&lt; class Ch, class Tr, class T&gt; inline
<span class="lineNum">      78 </span>            :     void put_head (BOOST_IO_STD basic_ostream&lt;Ch, Tr&gt; &amp; os, const T&amp; x ) {
<span class="lineNum">      79 </span>            :         disambiguater&lt;Ch, Tr, T&gt;::put_head(os, x, 1L);
<span class="lineNum">      80 </span>            :     }
<span class="lineNum">      81 </span>            :     template&lt; class Ch, class Tr, class T&gt; inline
<span class="lineNum">      82 </span>            :     void put_last (BOOST_IO_STD basic_ostream&lt;Ch, Tr&gt; &amp; os, const T&amp; x ) {
<span class="lineNum">      83 </span>            :         disambiguater&lt;Ch, Tr, T&gt;::put_last(os, x, 1L);
<span class="lineNum">      84 </span>            :     }
<span class="lineNum">      85 </span>            : 
<span class="lineNum">      86 </span>            : #else  
<span class="lineNum">      87 </span>            : 
<span class="lineNum">      88 </span>            :     template&lt; class Ch, class Tr, class T&gt; inline
<span class="lineNum">      89 </span>            :     void put_head (BOOST_IO_STD basic_ostream&lt;Ch, Tr&gt; &amp;, const T&amp; ) {
<span class="lineNum">      90 </span>            :     }
<span class="lineNum">      91 </span>            : 
<span class="lineNum">      92 </span>            :     template&lt; class Ch, class Tr, class T&gt; inline
<span class="lineNum">      93 </span>            :     void put_head( BOOST_IO_STD basic_ostream&lt;Ch, Tr&gt; &amp; os, const group1&lt;T&gt;&amp; x ) {
<span class="lineNum">      94 </span>            :         os &lt;&lt; group_head(x.a1_); // send the first N-1 items, not the last
<span class="lineNum">      95 </span>            :     }
<span class="lineNum">      96 </span>            : 
<span class="lineNum">      97 </span>            :     template&lt; class Ch, class Tr, class T&gt; inline
<span class="lineNum">      98 </span>            :     void put_last( BOOST_IO_STD basic_ostream&lt;Ch, Tr&gt; &amp; os, const T&amp; x ) {
<span class="lineNum">      99 </span><span class="lineNoCov">          0 :         os &lt;&lt; x ;</span>
<span class="lineNum">     100 </span>            :     }
<span class="lineNum">     101 </span>            : 
<span class="lineNum">     102 </span>            :     template&lt; class Ch, class Tr, class T&gt; inline
<span class="lineNum">     103 </span>            :     void put_last( BOOST_IO_STD basic_ostream&lt;Ch, Tr&gt; &amp; os, const group1&lt;T&gt;&amp; x ) {
<span class="lineNum">     104 </span>            :         os &lt;&lt; group_last(x.a1_); // this selects the last element
<span class="lineNum">     105 </span>            :     }
<span class="lineNum">     106 </span>            : 
<span class="lineNum">     107 </span>            : #ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST 
<span class="lineNum">     108 </span>            :     template&lt; class Ch, class Tr, class T&gt; inline
<span class="lineNum">     109 </span>            :     void put_head( BOOST_IO_STD basic_ostream&lt;Ch, Tr&gt; &amp;, T&amp; ) {
<span class="lineNum">     110 </span>            :     }
<span class="lineNum">     111 </span>            : 
<span class="lineNum">     112 </span>            :     template&lt; class Ch, class Tr, class T&gt; inline
<span class="lineNum">     113 </span>            :     void put_last( BOOST_IO_STD basic_ostream&lt;Ch, Tr&gt; &amp; os, T&amp; x) {
<span class="lineNum">     114 </span>            :         os &lt;&lt; x ;
<span class="lineNum">     115 </span>            :     }
<span class="lineNum">     116 </span>            : #endif
<span class="lineNum">     117 </span>            : #endif  // -__DECCXX workaround
<a name="118"><span class="lineNum">     118 </span>            : </a>
<span class="lineNum">     119 </span>            :     template&lt; class Ch, class Tr, class T&gt;
<span class="lineNum">     120 </span><span class="lineNoCov">          0 :     void call_put_head(BOOST_IO_STD basic_ostream&lt;Ch, Tr&gt; &amp; os, const void* x) {</span>
<span class="lineNum">     121 </span>            :         put_head(os, *(typename ::boost::remove_reference&lt;T&gt;::type*)x);
<span class="lineNum">     122 </span><span class="lineNoCov">          0 :     }</span>
<a name="123"><span class="lineNum">     123 </span>            : </a>
<span class="lineNum">     124 </span>            :     template&lt; class Ch, class Tr, class T&gt;
<span class="lineNum">     125 </span><span class="lineNoCov">          0 :     void call_put_last(BOOST_IO_STD basic_ostream&lt;Ch, Tr&gt; &amp; os, const void* x) {</span>
<span class="lineNum">     126 </span>            :         put_last(os, *(T*)x);
<span class="lineNum">     127 </span><span class="lineNoCov">          0 :     }</span>
<span class="lineNum">     128 </span>            : 
<span class="lineNum">     129 </span>            :     template&lt; class Ch, class Tr&gt;
<span class="lineNum">     130 </span>            :     struct put_holder {
<span class="lineNum">     131 </span>            :         template&lt;class T&gt;
<span class="lineNum">     132 </span>            :         put_holder(T&amp; t)
<span class="lineNum">     133 </span>            :           : arg(&amp;t),
<span class="lineNum">     134 </span>            :             put_head(&amp;call_put_head&lt;Ch, Tr, T&gt;),
<span class="lineNum">     135 </span><span class="lineNoCov">          0 :             put_last(&amp;call_put_last&lt;Ch, Tr, T&gt;)</span>
<span class="lineNum">     136 </span>            :         {}
<span class="lineNum">     137 </span>            :         const void* arg;
<span class="lineNum">     138 </span>            :         void (*put_head)(BOOST_IO_STD basic_ostream&lt;Ch, Tr&gt; &amp; os, const void* x);
<span class="lineNum">     139 </span>            :         void (*put_last)(BOOST_IO_STD basic_ostream&lt;Ch, Tr&gt; &amp; os, const void* x);
<span class="lineNum">     140 </span>            :     };
<span class="lineNum">     141 </span>            :     
<span class="lineNum">     142 </span>            :     template&lt; class Ch, class Tr&gt; inline
<span class="lineNum">     143 </span>            :     void put_head( BOOST_IO_STD basic_ostream&lt;Ch, Tr&gt; &amp; os, const put_holder&lt;Ch, Tr&gt;&amp; t) {
<span class="lineNum">     144 </span><span class="lineNoCov">          0 :         t.put_head(os, t.arg);</span>
<span class="lineNum">     145 </span>            :     }
<span class="lineNum">     146 </span>            :     
<span class="lineNum">     147 </span>            :     template&lt; class Ch, class Tr&gt; inline
<span class="lineNum">     148 </span>            :     void put_last( BOOST_IO_STD basic_ostream&lt;Ch, Tr&gt; &amp; os, const put_holder&lt;Ch, Tr&gt;&amp; t) {
<span class="lineNum">     149 </span><span class="lineNoCov">          0 :         t.put_last(os, t.arg);</span>
<span class="lineNum">     150 </span>            :     }
<span class="lineNum">     151 </span>            : 
<a name="152"><span class="lineNum">     152 </span>            : </a>
<span class="lineNum">     153 </span>            :     template&lt; class Ch, class Tr, class Alloc, class T&gt; 
<span class="lineNum">     154 </span><span class="lineNoCov">          0 :     void put( T x, </span>
<span class="lineNum">     155 </span>            :               const format_item&lt;Ch, Tr, Alloc&gt;&amp; specs, 
<span class="lineNum">     156 </span>            :               typename basic_format&lt;Ch, Tr, Alloc&gt;::string_type&amp; res, 
<span class="lineNum">     157 </span>            :               typename basic_format&lt;Ch, Tr, Alloc&gt;::internal_streambuf_t &amp; buf,
<span class="lineNum">     158 </span>            :               io::detail::locale_t *loc_p = NULL)
<span class="lineNum">     159 </span>            :     {
<span class="lineNum">     160 </span>            : #ifdef BOOST_MSVC
<span class="lineNum">     161 </span>            :        // If std::min&lt;unsigned&gt; or std::max&lt;unsigned&gt; are already instantiated
<span class="lineNum">     162 </span>            :        // at this point then we get a blizzard of warning messages when we call
<span class="lineNum">     163 </span>            :        // those templates with std::size_t as arguments.  Weird and very annoyning...
<span class="lineNum">     164 </span>            : #pragma warning(push)
<span class="lineNum">     165 </span>            : #pragma warning(disable:4267)
<span class="lineNum">     166 </span>            : #endif
<span class="lineNum">     167 </span>            :         // does the actual conversion of x, with given params, into a string
<span class="lineNum">     168 </span>            :         // using the supplied stringbuf.
<span class="lineNum">     169 </span>            : 
<span class="lineNum">     170 </span>            :         typedef typename basic_format&lt;Ch, Tr, Alloc&gt;::string_type   string_type;
<span class="lineNum">     171 </span>            :         typedef typename basic_format&lt;Ch, Tr, Alloc&gt;::format_item_t format_item_t;
<span class="lineNum">     172 </span>            :         typedef typename string_type::size_type size_type;
<span class="lineNum">     173 </span>            : 
<span class="lineNum">     174 </span><span class="lineNoCov">          0 :         basic_oaltstringstream&lt;Ch, Tr, Alloc&gt;  oss( &amp;buf);</span>
<span class="lineNum">     175 </span><span class="lineNoCov">          0 :         specs.fmtstate_.apply_on(oss, loc_p);</span>
<span class="lineNum">     176 </span>            : 
<span class="lineNum">     177 </span>            :         // the stream format state can be modified by manipulators in the argument :
<span class="lineNum">     178 </span>            :         put_head( oss, x );
<span class="lineNum">     179 </span>            :         // in case x is a group, apply the manip part of it, 
<span class="lineNum">     180 </span>            :         // in order to find width
<span class="lineNum">     181 </span>            : 
<span class="lineNum">     182 </span>            :         const std::ios_base::fmtflags fl=oss.flags();
<span class="lineNum">     183 </span><span class="lineNoCov">          0 :         const bool internal = (fl &amp; std::ios_base::internal) != 0;</span>
<span class="lineNum">     184 </span>            :         const std::streamsize w = oss.width();
<span class="lineNum">     185 </span><span class="lineNoCov">          0 :         const bool two_stepped_padding= internal &amp;&amp; (w!=0);</span>
<span class="lineNum">     186 </span>            :       
<span class="lineNum">     187 </span>            :         res.resize(0);
<span class="lineNum">     188 </span><span class="lineNoCov">          0 :         if(! two_stepped_padding) {</span>
<span class="lineNum">     189 </span><span class="lineNoCov">          0 :             if(w&gt;0) // handle padding via mk_str, not natively in stream </span>
<span class="lineNum">     190 </span>            :                 oss.width(0);
<span class="lineNum">     191 </span>            :             put_last( oss, x);
<span class="lineNum">     192 </span>            :             const Ch * res_beg = buf.pbase();
<span class="lineNum">     193 </span>            :             Ch prefix_space = 0;
<span class="lineNum">     194 </span><span class="lineNoCov">          0 :             if(specs.pad_scheme_ &amp; format_item_t::spacepad)</span>
<span class="lineNum">     195 </span><span class="lineNoCov">          0 :                 if(buf.pcount()== 0 || </span>
<span class="lineNum">     196 </span>            :                    (res_beg[0] !=oss.widen('+') &amp;&amp; res_beg[0] !=oss.widen('-')  ))
<span class="lineNum">     197 </span>            :                     prefix_space = oss.widen(' ');
<span class="lineNum">     198 </span><span class="lineNoCov">          0 :             size_type res_size = (std::min)(</span>
<span class="lineNum">     199 </span><span class="lineNoCov">          0 :                 static_cast&lt;size_type&gt;(specs.truncate_ - !!prefix_space), </span>
<span class="lineNum">     200 </span><span class="lineNoCov">          0 :                 buf.pcount() );</span>
<span class="lineNum">     201 </span><span class="lineNoCov">          0 :             mk_str(res, res_beg, res_size, w, oss.fill(), fl, </span>
<span class="lineNum">     202 </span><span class="lineNoCov">          0 :                    prefix_space, (specs.pad_scheme_ &amp; format_item_t::centered) !=0 );</span>
<span class="lineNum">     203 </span>            :         }
<span class="lineNum">     204 </span>            :         else  { // 2-stepped padding
<span class="lineNum">     205 </span>            :             // internal can be implied by zeropad, or user-set.
<span class="lineNum">     206 </span>            :             // left, right, and centered alignment overrule internal,
<span class="lineNum">     207 </span>            :             // but spacepad or truncate might be mixed with internal (using manipulator)
<span class="lineNum">     208 </span>            :             put_last( oss, x); // may pad
<span class="lineNum">     209 </span>            :             const Ch * res_beg = buf.pbase();
<span class="lineNum">     210 </span>            :             size_type res_size = buf.pcount();
<span class="lineNum">     211 </span>            :             bool prefix_space=false;
<span class="lineNum">     212 </span><span class="lineNoCov">          0 :             if(specs.pad_scheme_ &amp; format_item_t::spacepad)</span>
<span class="lineNum">     213 </span><span class="lineNoCov">          0 :                 if(buf.pcount()== 0 || </span>
<span class="lineNum">     214 </span>            :                    (res_beg[0] !=oss.widen('+') &amp;&amp; res_beg[0] !=oss.widen('-')  ))
<span class="lineNum">     215 </span>            :                     prefix_space = true;
<span class="lineNum">     216 </span><span class="lineNoCov">          0 :             if(res_size == static_cast&lt;size_type&gt;(w) &amp;&amp; w&lt;=specs.truncate_ &amp;&amp; !prefix_space) {</span>
<span class="lineNum">     217 </span>            :                 // okay, only one thing was printed and padded, so res is fine
<span class="lineNum">     218 </span>            :                 res.assign(res_beg, res_size);
<span class="lineNum">     219 </span>            :             }
<span class="lineNum">     220 </span>            :             else { //   length w exceeded
<span class="lineNum">     221 </span>            :                 // either it was multi-output with first output padding up all width..
<span class="lineNum">     222 </span>            :                 // either it was one big arg and we are fine.
<span class="lineNum">     223 </span>            :                 // Note that res_size&lt;w is possible  (in case of bad user-defined formatting)
<span class="lineNum">     224 </span>            :                 res.assign(res_beg, res_size);
<span class="lineNum">     225 </span>            :                 res_beg=NULL;  // invalidate pointers.
<span class="lineNum">     226 </span>            :                 
<span class="lineNum">     227 </span>            :                 // make a new stream, to start re-formatting from scratch :
<span class="lineNum">     228 </span><span class="lineNoCov">          0 :                 buf.clear_buffer();</span>
<span class="lineNum">     229 </span><span class="lineNoCov">          0 :                 basic_oaltstringstream&lt;Ch, Tr, Alloc&gt;  oss2( &amp;buf);</span>
<span class="lineNum">     230 </span><span class="lineNoCov">          0 :                 specs.fmtstate_.apply_on(oss2, loc_p);</span>
<span class="lineNum">     231 </span>            :                 put_head( oss2, x );
<span class="lineNum">     232 </span>            : 
<span class="lineNum">     233 </span>            :                 oss2.width(0);
<span class="lineNum">     234 </span><span class="lineNoCov">          0 :                 if(prefix_space)</span>
<span class="lineNum">     235 </span>            :                     oss2 &lt;&lt; ' ';
<span class="lineNum">     236 </span>            :                 put_last(oss2, x );
<span class="lineNum">     237 </span><span class="lineNoCov">          0 :                 if(buf.pcount()==0 &amp;&amp; specs.pad_scheme_ &amp; format_item_t::spacepad) {</span>
<span class="lineNum">     238 </span>            :                     prefix_space =true;
<span class="lineNum">     239 </span>            :                     oss2 &lt;&lt; ' ';
<span class="lineNum">     240 </span>            :                 }
<span class="lineNum">     241 </span>            :                 // we now have the minimal-length output
<span class="lineNum">     242 </span>            :                 const Ch * tmp_beg = buf.pbase();
<span class="lineNum">     243 </span><span class="lineNoCov">          0 :                 size_type tmp_size = (std::min)(static_cast&lt;size_type&gt;(specs.truncate_),</span>
<span class="lineNum">     244 </span><span class="lineNoCov">          0 :                                                 buf.pcount() );</span>
<span class="lineNum">     245 </span>            :                                                     
<span class="lineNum">     246 </span>            :                 
<span class="lineNum">     247 </span><span class="lineNoCov">          0 :                 if(static_cast&lt;size_type&gt;(w) &lt;= tmp_size) { </span>
<span class="lineNum">     248 </span>            :                     // minimal length is already &gt;= w, so no padding (cool!)
<span class="lineNum">     249 </span>            :                         res.assign(tmp_beg, tmp_size);
<span class="lineNum">     250 </span>            :                 }
<span class="lineNum">     251 </span>            :                 else { // hum..  we need to pad (multi_output, or spacepad present)
<span class="lineNum">     252 </span>            :                     //find where we should pad
<span class="lineNum">     253 </span><span class="lineNoCov">          0 :                     size_type sz = (std::min)(res_size + (prefix_space ? 1 : 0), tmp_size);</span>
<span class="lineNum">     254 </span><span class="lineNoCov">          0 :                     size_type i = prefix_space;</span>
<span class="lineNum">     255 </span><span class="lineNoCov">          0 :                     for(; i&lt;sz &amp;&amp; tmp_beg[i] == res[i - (prefix_space ? 1 : 0)]; ++i) {}</span>
<span class="lineNum">     256 </span><span class="lineNoCov">          0 :                     if(i&gt;=tmp_size) i=prefix_space;</span>
<span class="lineNum">     257 </span>            :                     res.assign(tmp_beg, i);
<span class="lineNum">     258 </span><span class="lineNoCov">          0 :                                         std::streamsize d = w - static_cast&lt;std::streamsize&gt;(tmp_size);</span>
<span class="lineNum">     259 </span>            :                                         BOOST_ASSERT(d&gt;0);
<span class="lineNum">     260 </span><span class="lineNoCov">          0 :                     res.append(static_cast&lt;size_type&gt;( d ), oss2.fill());</span>
<span class="lineNum">     261 </span><span class="lineNoCov">          0 :                     res.append(tmp_beg+i, tmp_size-i);</span>
<span class="lineNum">     262 </span>            :                     BOOST_ASSERT(i+(tmp_size-i)+(std::max)(d,(std::streamsize)0) 
<span class="lineNum">     263 </span>            :                                  == static_cast&lt;size_type&gt;(w));
<span class="lineNum">     264 </span>            :                     BOOST_ASSERT(res.size() == static_cast&lt;size_type&gt;(w));
<span class="lineNum">     265 </span>            :                 }
<span class="lineNum">     266 </span>            :             }
<span class="lineNum">     267 </span>            :         }
<span class="lineNum">     268 </span><span class="lineNoCov">          0 :         buf.clear_buffer();</span>
<span class="lineNum">     269 </span>            : #ifdef BOOST_MSVC
<span class="lineNum">     270 </span>            : #pragma warning(pop)
<span class="lineNum">     271 </span>            : #endif
<span class="lineNum">     272 </span><span class="lineNoCov">          0 :     } // end- put(..)</span>
<span class="lineNum">     273 </span>            : 
<a name="274"><span class="lineNum">     274 </span>            : </a>
<span class="lineNum">     275 </span>            :     template&lt; class Ch, class Tr, class Alloc, class T&gt; 
<span class="lineNum">     276 </span><span class="lineNoCov">          0 :     void distribute (basic_format&lt;Ch,Tr, Alloc&gt;&amp; self, T x) {</span>
<span class="lineNum">     277 </span>            :         // call put(x, ..) on every occurence of the current argument :
<span class="lineNum">     278 </span><span class="lineNoCov">          0 :         if(self.cur_arg_ &gt;= self.num_args_)  {</span>
<span class="lineNum">     279 </span><span class="lineNoCov">          0 :             if( self.exceptions() &amp; too_many_args_bit )</span>
<span class="lineNum">     280 </span><span class="lineNoCov">          0 :                 boost::throw_exception(too_many_args(self.cur_arg_, self.num_args_)); </span>
<span class="lineNum">     281 </span>            :             else return;
<span class="lineNum">     282 </span>            :         }
<span class="lineNum">     283 </span><span class="lineNoCov">          0 :         for(unsigned long i=0; i &lt; self.items_.size(); ++i) {</span>
<span class="lineNum">     284 </span><span class="lineNoCov">          0 :             if(self.items_[i].argN_ == self.cur_arg_) {</span>
<span class="lineNum">     285 </span><span class="lineNoCov">          0 :                 put&lt;Ch, Tr, Alloc, T&gt; (x, self.items_[i], self.items_[i].res_, </span>
<span class="lineNum">     286 </span>            :                                 self.buf_, boost::get_pointer(self.loc_) );
<span class="lineNum">     287 </span>            :             }
<span class="lineNum">     288 </span>            :         }
<span class="lineNum">     289 </span>            :     }
<span class="lineNum">     290 </span>            : 
<a name="291"><span class="lineNum">     291 </span>            :     template&lt;class Ch, class Tr, class Alloc, class T&gt; </a>
<span class="lineNum">     292 </span>            :     basic_format&lt;Ch, Tr, Alloc&gt;&amp;  
<span class="lineNum">     293 </span><span class="lineNoCov">          0 :     feed_impl (basic_format&lt;Ch,Tr, Alloc&gt;&amp; self, T x) {</span>
<span class="lineNum">     294 </span><span class="lineNoCov">          0 :         if(self.dumped_) self.clear();</span>
<span class="lineNum">     295 </span><span class="lineNoCov">          0 :         distribute&lt;Ch, Tr, Alloc, T&gt; (self, x);</span>
<span class="lineNum">     296 </span><span class="lineNoCov">          0 :         ++self.cur_arg_;</span>
<span class="lineNum">     297 </span><span class="lineNoCov">          0 :         if(self.bound_.size() != 0) {</span>
<span class="lineNum">     298 </span><span class="lineNoCov">          0 :                 while( self.cur_arg_ &lt; self.num_args_ &amp;&amp; self.bound_[self.cur_arg_] )</span>
<span class="lineNum">     299 </span><span class="lineNoCov">          0 :                     ++self.cur_arg_;</span>
<span class="lineNum">     300 </span>            :         }
<span class="lineNum">     301 </span><span class="lineNoCov">          0 :         return self;</span>
<span class="lineNum">     302 </span>            :     }
<span class="lineNum">     303 </span>            : 
<span class="lineNum">     304 </span>            :     template&lt;class Ch, class Tr, class Alloc, class T&gt; inline
<span class="lineNum">     305 </span>            :     basic_format&lt;Ch, Tr, Alloc&gt;&amp;  
<span class="lineNum">     306 </span>            :     feed (basic_format&lt;Ch,Tr, Alloc&gt;&amp; self, T x) {
<span class="lineNum">     307 </span><span class="lineNoCov">          0 :         return feed_impl&lt;Ch, Tr, Alloc, const put_holder&lt;Ch, Tr&gt;&amp;&gt;(self, put_holder&lt;Ch, Tr&gt;(x));</span>
<span class="lineNum">     308 </span>            :     }
<span class="lineNum">     309 </span>            :     
<span class="lineNum">     310 </span>            : } // namespace detail
<span class="lineNum">     311 </span>            : } // namespace io
<span class="lineNum">     312 </span>            : } // namespace boost
<span class="lineNum">     313 </span>            : 
<span class="lineNum">     314 </span>            : 
<span class="lineNum">     315 </span>            : #endif //  BOOST_FORMAT_FEED_ARGS_HPP
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.12</a></td></tr>
  </table>
  <br>

</body>
</html>
